#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QKeyEvent>


class QLabel;
class QMessageBox;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

protected:
    void keyPressEvent(QKeyEvent *event) override;

private:
    static const int BOARD_SIZE = 4;
    int board[BOARD_SIZE][BOARD_SIZE];
    QLabel* tiles[BOARD_SIZE][BOARD_SIZE];
    QLabel *scoreLabel;

    void initializeBoard();
    void drawBoard();
    void newGame();
    void generateRandomTile();
    void moveTiles(int direction);
    bool canMove();
    bool checkGameOver();
    void updateScore();
    void showGameOverMessage();
    void updateBoard();
    bool gameIsOver;


    int score;

};

#endif // MAINWINDOW_H
